﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace Web
{
    public partial class ExamPaperItemDelete : System.Web.UI.Page
    {
        private int editid = 0, delid = 0, page = 1, ExamId = 0, qtypeid = 0, SubjectId=0;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!UserValidate.CheckLogin(this.Request, "MasterRole"))
            {
                Response.Write("<script type=\"text/javascript\">top.location.href='login.aspx';</script>");
                Response.Redirect("login.aspx");
                Response.End();
            }

            if (Request.QueryString["page"] != null)
            {
                page = Convert.ToInt32(Request.QueryString["page"].Trim());
            }
            if (Request.QueryString["SubjectId"] != null)
            {
                SubjectId = Convert.ToInt32(Request.QueryString["SubjectId"].Trim());
            }
            if (Request.QueryString["delid"] != null)
            {
                delid = Convert.ToInt32(Request.QueryString["delid"].Trim());
            }
            if (this.Request["ExamId"] != null && this.Request["ExamId"].ToString() != "")
            {
                string id = this.Request["ExamId"].ToString();
                ExamId = int.Parse(id);
            }
            if (this.Request["qtypeid"] != null && this.Request["qtypeid"].ToString() != "")
            {
                string id = this.Request["qtypeid"].ToString();
                qtypeid = int.Parse(id);
            }
            if (!IsPostBack)
            {
                if (delid > 0)
                {

                    BAL.Paper_Ques.Del(this.ExamId, delid);
                    Response.Redirect("ExamPaperCreate.aspx?SubjectId=" + SubjectId.ToString()+ "&id=" + this.ExamId.ToString() + "&qtypeid=" + qtypeid.ToString() + "&page=" + page.ToString());
                    return;
                }
            }
        }
    }
}
